package vista;

import javax.swing.JButton;
import javax.swing.ListModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

public class BotonBorrador extends JButton implements ListSelectionListener{
	
	private String funcion;
	
	public BotonBorrador(){
		super();
	}
	
	public BotonBorrador(String label){
		super(label);
	}
	
	public void valueChanged(ListSelectionEvent arg0) {
		VistaLista vista=(VistaLista) arg0.getSource();
		ListModel lista=vista.getModel();
		this.setFuncion((String)lista.getElementAt(arg0.getFirstIndex()));
	}
	
	public String getFuncion(){
		return this.funcion;
	}
	
	private void setFuncion(String funcion){
		this.funcion=funcion;
	}

}
